/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: transparent;
    overflow: hidden;
    user-select: none;
    -webkit-app-region: no-drag;
    font-size: 14px;
    color: #333;
}

/* 主容器 */
.app-container {
    position: relative;
    width: 100%;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: none;
    filter: none;
    backdrop-filter: none;
}

/* 回复区域 */
.reply-container {
    background: #ffffff;
    border-radius: 30px;
    margin-bottom: 10px;
    margin-top: 30px;
    border: 1px solid #e5e7eb;
    max-height: 450px;
    width: 400px;
    min-width: 400px;
    max-width: 400px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(-10px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    display: none;
    z-index: 1;
    box-sizing: border-box;
}

.reply-container.collapsed {
    margin-top: 0;
    max-height: 60px;
    overflow: visible;
    transition: all 0.3s ease;
}

.reply-container.collapsed .reply-header {
    border-bottom: none;
}

.reply-container.show {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
    display: block;
}

.reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(248, 250, 252, 0.8);
    min-height: 60px;
    position: relative;
    z-index: 100;
}

.reply-title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    z-index: 999;
}

.header-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 150;
    padding: 4px;
}

.collapse-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: rgba(156, 163, 175, 0.2);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 30px;
    color: #6b7280;
    transition: all 0.2s ease;
    position: relative;
    z-index: 300;
    margin: 0;
    padding: 6px;
    min-width: 30px;
    min-height: 30px;
    box-sizing: border-box;
}

.collapse-btn:hover {
    background: rgba(156, 163, 175, 0.3);
    transform: scale(1.05);
}

.collapse-btn:active {
    transform: scale(0.95);
    background: rgba(156, 163, 175, 0.4);
}

/* 按钮点击区域优化 */
.collapse-btn, .header-buttons .control-btn {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.reply-content {
    max-height: 320px;
    overflow-y: auto;
    padding: 0;
}

/* 消息项 */
.message-item {
    position: relative;
    padding: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s ease;
}

/* 流式消息样式 */
.message-item.streaming {
    border-left: 3px solid #00d4aa;
    background: rgba(240, 255, 250, 0.95);
}

/* 思考中文字动画 */
.thinking-text {
    display: inline-block;
    animation: thinking 1.5s ease-in-out infinite;
    color: #3b82f6;
    font-weight: 500;
    font-style: italic;
}

/* 流式光标动画 */
.streaming-cursor {
    display: inline-block;
    animation: blink 1s infinite;
    color: #00d4aa;
    font-weight: bold;
}

@keyframes thinking {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.message-item:hover {
    background: rgba(248, 250, 252, 0.5);
}

.message-item:last-child {
    border-bottom: none;
}

.user-message {
    margin-bottom: 8px;
    padding: 8px 12px;
    background: #f0f8ff;
    border-left: 3px solid #007bff;
    border-radius: 4px;
    font-weight: 500;
    color: #0056b3;
    line-height: 1.4;
    word-wrap: break-word;
}

.message-text {
    font-size: 14px;
    line-height: 1.6;
    color: #374151;
    word-wrap: break-word;
    white-space: pre-wrap;
    padding-top: 4px;
}

.message-time {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 8px;
}

/* 悬浮操作按钮 */
.message-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.2s ease;
    pointer-events: none;
}

.message-item:hover .message-actions {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); */
    transition: all 0.2s ease;
    color: #6b7280;
}

.action-btn:hover {
    background: #ffffff;
    transform: scale(1.05);
    /* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); */
}

.action-btn.regenerate {
    color: #3b82f6;
}

.action-btn.copy {
    color: #10b981;
}

/* 输入区域 */
.input-container {
    position: relative;
    z-index: 10;
    width: 400px;
    min-width: 400px;
    max-width: 400px;
    box-sizing: border-box;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: #ffffff;
    border-radius: 30px;
    padding: 8px;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: #3b82f6;
}

.message-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 12px 20px;
    font-size: 14px;
    color: #374151;
    placeholder-color: #9ca3af;
}

.message-input::placeholder {
    color: #9ca3af;
}

.send-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: #3b82f6;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s ease;
}



.send-btn:hover {
    background: #2563eb;
    transform: scale(1.05);
}

.send-btn:active {
    transform: scale(0.95);
}

.send-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 头部关闭按钮 */
.header-buttons .control-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    z-index: 300;
    margin: 0;
    padding: 6px;
    min-width: 30px;
    min-height: 30px;
    box-sizing: border-box;
}

.header-buttons .close-btn {
    background: #dc3545;
    color: #ffffff;
}

.header-buttons .control-btn:hover {
    transform: scale(1.05);
}

.header-buttons .control-btn:active {
    transform: scale(0.95);
}

/* 拖拽区域 */
.drag-area {
    position: absolute;
    top: 0;
    left: 0;
    right: 60px;
    height: 60px;
    -webkit-app-region: drag;
    z-index: 1;
}



/* 滚动条样式 */
.reply-content::-webkit-scrollbar {
    width: 6px;
}

.reply-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.reply-content::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.5);
    border-radius: 3px;
}

.reply-content::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 0.7);
}

/* 响应式设计 */
@media (max-width: 480px) {
    .app-container {
        width: 100%;
        max-width: 360px;
    }
    
    .message-input {
        font-size: 16px; /* 防止iOS缩放 */
    }
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}